﻿using System;
using System.Xml;
using YArchitech.HCLoad.Utils;

namespace YArchitech.HCLoad.Parameters
{
	public class SpaceAttribute
	{
		public int PropId
		{
			get
			{
				return this.m_nPropId;
			}
		}

		public string GUID
		{
			get
			{
				return this.m_sGUID;
			}
		}

		public string EnName
		{
			get
			{
				return this.m_sEnName;
			}
		}

		public string CnName
		{
			get
			{
				return this.m_sCnName;
			}
		}

		public string DataType
		{
			get
			{
				return this.m_sDataType;
			}
		}

		public string GroupId
		{
			get
			{
				return this.m_sGroupId;
			}
		}

		public string DataCategory
		{
			get
			{
				return this.m_sDataCategory;
			}
			set
			{
				this.m_sDataCategory = value;
			}
		}

		public bool Visible
		{
			get
			{
				return this.m_bVisible;
			}
		}

		public string Unit
		{
			get
			{
				return this.m_sUnit;
			}
			set
			{
				this.m_sUnit = value;
			}
		}

		public string Remark
		{
			get
			{
				return this.m_sRemark;
			}
		}

		public bool Cheked
		{
			get
			{
				return this.m_bChecked;
			}
			set
			{
				this.m_bChecked = value;
			}
		}

		public SpaceAttributeGroup Group
		{
			get
			{
				return this.m_Goup;
			}
			set
			{
				this.m_Goup = value;
			}
		}

		public SpaceAttribute(SpaceAttributeGroup group)
		{
			this.m_Goup = group;
		}

		public string Name
		{
			get
			{
				if (!HcUtils.IsEnglish)
				{
					return this.CnName;
				}
				return this.EnName;
			}
		}

		public bool DoPropExchange(ref XmlElement elem, bool bLoading)
		{
			if (bLoading)
			{
				string attribute = elem.GetAttribute("propid");
				this.m_nPropId = int.Parse(attribute);
				this.m_sGUID = elem.GetAttribute("guid");
				this.m_sEnName = elem.GetAttribute("enname");
				this.m_sCnName = elem.GetAttribute("cnname");
				this.m_sDataType = elem.GetAttribute("datatype");
				this.m_sDataCategory = elem.GetAttribute("datacategory");
				this.m_sGroupId = elem.GetAttribute("group");
				string attribute2 = elem.GetAttribute("visible");
				this.m_bVisible = (attribute2.CompareTo("1") == 0);
				this.m_sUnit = elem.GetAttribute("unit");
				this.m_sRemark = elem.GetAttribute("remark");
				string attribute3 = elem.GetAttribute("checked");
				this.m_bChecked = (attribute3.CompareTo("1") == 0);
			}
			else
			{
				elem.SetAttribute("propid", this.m_nPropId.ToString());
				elem.SetAttribute("guid", this.m_sGUID);
				elem.SetAttribute("enname", this.m_sEnName);
				elem.SetAttribute("cnname", this.m_sCnName);
				elem.SetAttribute("datatype", this.m_sDataType);
				elem.SetAttribute("datacategory", this.m_sDataCategory);
				elem.SetAttribute("group", this.m_sGroupId);
				string value = this.m_bVisible ? "1" : "0";
				elem.SetAttribute("visible", value);
				elem.SetAttribute("unit", this.m_sUnit);
				elem.SetAttribute("remark", this.m_sRemark);
				string value2 = this.m_bChecked ? "1" : "0";
				elem.SetAttribute("checked", value2);
			}
			return true;
		}

		private SpaceAttributeGroup m_Goup;

		private int m_nPropId;

		private string m_sGUID;

		private string m_sEnName = "";

		private string m_sCnName = "";

		private string m_sDataType = "";

		private string m_sDataCategory = "";

		private string m_sGroupId = "";

		private bool m_bVisible = true;

		private string m_sUnit = "";

		private string m_sRemark = "";

		private bool m_bChecked = true;
	}
}
